/**
 * 
 */
package pacMan;


/**
 * Class: ConsumableObject
 * 
 * Defines an object that can be consumed by another object when 
 * they are overlaying one another.
 * 
 * @author 		Tomas Rivera
 * @version 	$Id$
 *
 */
public abstract class ConsumableObject extends BasicDrawableObject {
	
	//////////////////////////////////////////////////////////
	// Constructor methods
	//////////////////////////////////////////////////////////
	
	/**
	 * Creates a ConsumableObject, which has a location and a point value.
	 * Other attributes include whether it is hazardous to an Actor,
	 * if it is currently consumable by an Actor, or if it is currently visible.
	 * 
	 * Note: an object can never both be "edible" and "hazardous" at the same time.
	 * 
	 * @param c
	 * @param w
	 * @param pValue
	 */
	public ConsumableObject(Coordinate c, WindowParameters w, int pValue) {
		super(c, w);
		pointValue = pValue;
		edible = false;
		hazardous = false;
		visible = true;
	}
	
	//////////////////////////////////////////////////////////
	// Abstract methods
	//////////////////////////////////////////////////////////
	
	/**
	 * Defines the actions that are taken when one object
	 * "consumes" another.
	 * 
	 * @param consumer
	 */
	public abstract void consumeObject(Actor consumer);
	
	//////////////////////////////////////////////////////////
	// Public / Protected methods
	//////////////////////////////////////////////////////////
	
	/**
	 * Get the current point value of the object.
	 * 
	 * @return pointValue
	 */
	public int getPointValue() {
		return pointValue;
	}
	
	public void updatePointValue(int newValue) { pointValue = newValue; }
	
	public boolean edible() { return edible == true; }
	
	/**
	 * Sets flag that determines if object can currently be consumed
	 * by certain Actors.
	 * 
	 * @param edible
	 */
	public void setEdible(boolean edible) { this.edible = edible; }
	
	/**
	 * Check if the object is marked as a hazard.
	 * 
	 * @return
	 */
	public boolean hazardous() { return hazardous == true; }
	
	
	/**
	 * Set flag that determines if object is currently hazardous to
	 * certain Actors.
	 * 
	 * @param hazardous
	 */
	public void setHazardous(boolean hazardous) { this.hazardous = hazardous; }
	
	/**
	 * Flag object as visible.
	 * 
	 */
	public void show() { visible = true; }
	
	/**
	 * Flag object as hidden.
	 * 
	 */
	public void hide() { visible = false; }
	
	/**
	 * Check if object should be visible on-screen.
	 * 
	 * @return
	 */
	public boolean visible() { return visible; }


	//////////////////////////////////////////////////////////
	// Private member variables
	//////////////////////////////////////////////////////////

	private int pointValue;
	private boolean edible;
	private boolean hazardous;
	private boolean visible;
}
